// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   ErrLog.java

package com.vandagroup.common.util;

import com.vandagroup.common.bean.FormBean;
import com.vandagroup.common.bo.ESSObject;
import com.vandagroup.common.db.ESSDataStoreManager;
import com.vandagroup.common.po.ESSPO;
import java.io.PrintStream;
import java.sql.*;

// Referenced classes of package com.vandagroup.common.util:
//            ErrForm

public class ErrLog extends ESSPO
{

    public ErrForm bean;

    public ErrLog()
    {
        bean = null;
    }

    public int add()
        throws SQLException
    {
        int row;
        row = 0;
        String tempSQL = getInsertSQL();
        PreparedStatement ps = null;
        Connection conn = null;
        try
        {
            conn = ESSObject.getDataStore().getConnection();
            ps = conn.prepareStatement(tempSQL);
            prepareInsertStatement(ps);
            row = ps.executeUpdate();
        }
        catch(SQLException ex)
        {
            System.out.println("Log Error:" + ex);
            throw ex;
        }
        finally
        {
            ESSObject.getDataStore().freeConnection(conn);
            if(ps != null)
                ps.close();
            conn = null;
            tempSQL = null;
        }
        return row;
    }

    public FormBean fetchResult(ResultSet rs)
        throws SQLException
    {
        ErrForm bean = new ErrForm();
        bean.setOwner(rs.getString("OWNER"));
        bean.setTime(rs.getTimestamp("TIME"));
        bean.setLevel(rs.getString("LEVEL"));
        bean.setMessage(rs.getString("MESSAGE"));
        bean.setExp(rs.getString("EXP"));
        return bean;
    }

    public String getColumnNames()
    {
        return "OWNER, TIME, LEVEL, MESSAGE, EXP";
    }

    public String getInsertValuesString()
    {
        return "?, ?, ?, ?, ?";
    }

    public String getTableName()
    {
        return "ERRLOG";
    }

    public String getUpdateValuesString()
    {
        return "";
    }

    public void prepareInsertStatement(PreparedStatement ps)
        throws SQLException
    {
        ps.setString(1, bean.getOwner());
        ps.setTimestamp(2, bean.getTime());
        ps.setString(3, bean.getLevel());
        ps.setString(4, bean.getMessage());
        ps.setString(5, bean.getExp());
    }

    public void prepareUpdateStatement(PreparedStatement preparedstatement1)
        throws SQLException
    {
    }

    public ErrForm getBean()
    {
        return bean;
    }

    public void setBean(ErrForm bean)
    {
        this.bean = bean;
    }

    public FormBean getFormBean()
    {
        return bean;
    }
}
